package butines.game;

import butines.core.Image;
import butines.game.state.GlobalUnitState;

public class UnitSample {
	private UnitModel model;
	private Image image;

	private float maxSpeed;
	private float maxForce;
	private float mass;
	private float radius;

	private int maxHealth;
	private int attack;

	private int range;
	private int sight;
	private float coolDown;

	private float viewDistance;

	public UnitSample() {
	}

	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

	public float getMaxSpeed() {
		return maxSpeed;
	}

	public void setMaxSpeed(float maxSpeed) {
		this.maxSpeed = maxSpeed;
	}

	public float getMaxForce() {
		return maxForce;
	}

	public void setMaxForce(float maxForce) {
		this.maxForce = maxForce;
	}

	public float getMass() {
		return mass;
	}

	public void setMass(float mass) {
		this.mass = mass;
	}

	public float getRadius() {
		return radius;
	}

	public void setRadius(float radius) {
		this.radius = radius;
	}

	public int getMaxHealth() {
		return maxHealth;
	}

	public void setMaxHealth(int maxHealth) {
		this.maxHealth = maxHealth;
	}

	public int getAttack() {
		return attack;
	}

	public void setAttack(int attack) {
		this.attack = attack;
	}

	public float getViewDistance() {
		return viewDistance;
	}

	public void setViewDistance(float viewDistance) {
		this.viewDistance = viewDistance;
	}

	public int getRange() {
		return range;
	}

	public void setRange(int range) {
		this.range = range;
	}

	public float getCoolDown() {
		return coolDown;
	}

	public void setCoolDown(float coolDown) {
		this.coolDown = coolDown;
	}

	public UnitModel getModel() {
		return model;
	}

	public void setModel(UnitModel model) {
		this.model = model;
	}

	public int getSight() {
		return sight;
	}

	public void setSight(int sight) {
		this.sight = sight;
	}

	public Unit create(Team team, float x, float y) {
		Unit unit = new Unit(team, model);
		unit.getPosition().set(x, y);
		unit.setMaxSpeed(maxSpeed);
		unit.setMaxForce(maxForce);
		unit.setMass(mass);
		unit.setRadius(radius);
		unit.setViewDistance(viewDistance);
		unit.setHealth(maxHealth);
		unit.setMaxHealth(maxHealth);
		unit.setAttackDamage(attack);
		unit.setAttackRange(range);
		unit.setAttackCooldown(coolDown);
//		unit.getStatus().setSight(sight);
		unit.getStateMachine().setGlobalState(GlobalUnitState.getInstance());
		unit.stay();
		team.addUnit(unit);


		return unit;
	}
	
}
